# -*- coding: utf-8 -*-
"""
Created on Fri Jun 28 15:05:42 2024
@author: Administrator
"""
import arcpy
#arcpy.env.workspace = u"C:/Users/Administrator/Desktop/1109/总库cs.gdb"
arcpy.env.workspace = arcpy.GetParameterAsText(0)
datasets = arcpy.ListDatasets(feature_type='feature')  #获取数据集列表
#遍历数据集
for ds in datasets:
	tt = arcpy.ListFeatureClasses(feature_dataset=ds)
	for fc in tt:
		desc = arcpy.Describe(fc)
		if desc.shapeType == "Polygon":
			name = desc.name  #获取要素类名称
			fc_aliasname = desc.aliasName  #获取要素类别名
			inFeature = arcpy.env.workspace + '/' + ds + '/' + name
			fieldList = arcpy.ListFields(inFeature)
			#field_name = []
			for f_List in fieldList:
				if f_List.baseName == 'MJ':
					exp = "round(!shape.geodesicArea!,2)"
					arcpy.CalculateField_management(inFeature, f_List.baseName, exp, "PYTHON_9.3")


